﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Machine.Specifications;
using NUnit.Framework;
using SportsStore.DataBaseInfrastructure;
using Raven.Client;
using System.Net;

namespace SportsStore.DatabaseInfraStructure.Test.DatabaseSessionCreation
{
    public class When_I_Ask_For_The_Session_With_Wrong_DataStorePath
    {
        static IDocumentStore ravenDatabase;
        static IDocumentSession ravenSession;
        static Exception exception;
        Establish context = () => 
        {
            ravenDatabase = new RavenDataBaseConnection(@"http://localhost:100").Connect();
        };

        Because I_Have_to_Give_The_Wrong_Path = () => 
        {

           exception= Catch.Exception(() =>
            {
                ravenSession = new RavenSession(ravenDatabase).OpenSession();
            });
 
        };

        It Should_Throw_The_Database_Not_Found_Exception = () => 
        {
            exception.ShouldBeOfType<WebException>();
        };
    }
}
